﻿/* 绝版点卷商店新加专卖Array(, 13000),*/

var status = -1;
var itemList = Array(
Array(5800000, 2000),
Array(5800001, 2000),
Array(5800002, 2000),
Array(1102798, 3000),
Array(1102822, 3000),
Array(1102824, 3000),
Array(1102831, 3000),
Array(1102832, 3000),
Array(1102837, 3000),
Array(1102841, 3000),
Array(1102766, 3000),
Array(1004336, 3000),
Array(1052852, 3000),
Array(1702636, 3000),
Array(1702627, 3000),
Array(1702628, 3000),
Array(1050371, 5000),
Array(1051440, 5000),
Array(1004040, 5500),
Array(1003910, 5500),
Array(1003955, 5500),
Array(1003943, 5500),
Array(1003937, 5500),
Array(1004600, 5500),
Array(1004595, 5500),
Array(1004592, 5500),
Array(1004591, 5500),
Array(1004590, 5500),
Array(1004589, 5500),
Array(1004583, 5500),
Array(1004580, 5500),
Array(1004638, 5500),
Array(1004636, 5500),
Array(1004635, 5500),
Array(1004632, 5500),
Array(1004631, 5500),
Array(1004630, 5500),
Array(1004629, 5500),
Array(1004628, 5500),
Array(1004638, 5500),
Array(1004636, 5500),
Array(1004635, 5500),
Array(1004632, 5500),
Array(1004631, 5500),
Array(1004630, 5500),
Array(1004629, 5500),
Array(1004628, 5500),
Array(1004602, 5500),
Array(1004601, 5500),
Array(1052986, 5500),
Array(1102867, 5500),
Array(1102864, 5500),
Array(1102860, 5500),
Array(1102859, 5500),
Array(1102858, 5500),
Array(1102857, 5500),
Array(1102855, 5500),
Array(1102854, 5500),
Array(1102853, 5500),
Array(1102844, 5500),
Array(1050293, 1300),
Array(1002355, 2300),
Array(1003807, 2300),
Array(1062126, 2300),
Array(1052864, 2300),
Array(1050346, 3300),
Array(1702562, 3300),
Array(1052911, 4300),
Array(1051415, 5300),
Array(1050343, 3300),
Array(1102759, 2300),
Array(1102758, 5300),
Array(1102643, 4300),
Array(1004450, 1300),
Array(1004328, 2300),
Array(1004276, 2300),
Array(1050361, 5300),
Array(1051431, 5300),
Array(1050340, 5300),
Array(1050341, 5300),
Array(1702581, 8300),
Array(1702575, 4300),
Array(1004467, 2300),
Array(1004440, 3300),
Array(1004469, 2300),
Array(1102819, 3300),
Array(1102815, 3300),
Array(1042348, 3300),
Array(1702453, 5000),
Array(1702454, 3000),
Array(1702455, 8000),
Array(1702469, 6000),
Array(1702476, 5000),
Array(1702487, 6000),
Array(1702525, 5000),
Array(1702529, 5000),
Array(1702562, 5000),
Array(1702583, 5000),
Array(1062137, 3000),
Array(1062183, 3000),
Array(1061205, 3000),
Array(1062189, 3000),
Array(1042293, 3000),
Array(1062217, 3000),
Array(1062219, 3000),
Array(1062208, 5000),
Array(1062179, 5000),
Array(1062209, 5000),
Array(1040193, 3000),
Array(1062138, 3000),
Array(1042260, 3000),
Array(1061206, 3000),
Array(1060179, 3000),
Array(1042264, 3000),
Array(1042269, 3000),
Array(1042290, 3000),
Array(1062216, 3000),
Array(1042329, 3000),
Array(1042333, 3000),
Array(1042334, 3000),
Array(1042345, 3000),
Array(1062229, 3000),
Array(1042347, 3000),
Array(1102274, 3000),
Array(1102356, 3000),
Array(1102392, 3000),
Array(1102617, 3000),
Array(1102619, 3000),
Array(1102551, 3000),
Array(1102615, 3000),
Array(1102621, 3000),
Array(1102667, 3000),
Array(1102675, 3000),
Array(1102665, 3000),
Array(1102700, 3000),
Array(1102708, 3000),
Array(1102707, 3000),
Array(1102712, 3000),
Array(1102725, 3000),
Array(1102747, 3000),
Array(1102749, 5000),
Array(1102755, 3000),
Array(1102767, 3000),
Array(1102774, 3000),
Array(1102778, 5000),
Array(1072529, 1500),
Array(1072531, 1500),
Array(1072851, 1500),
Array(1072862, 1500),
Array(1072934, 1500),
Array(1004213, 4500),
Array(1702535, 3500),
Array(1072951, 1500),
Array(1072943, 1500),
Array(1072998, 1500),
Array(1073047, 1500),
Array(1073046, 1500),
Array(1073013, 1500),
Array(1073014, 1500),
Array(1022194, 2000),
Array(1012468, 2000),
Array(1032145, 1000),
Array(1012388, 1300),
Array(1022229, 2300),
Array(1012427, 1300),
Array(1012436, 1300),
Array(1012450, 1300),
Array(1012384, 1300),
Array(1032210, 1300),
Array(1012462, 1300),
Array(1022217, 1300),
Array(1012472, 1300),
Array(1012489, 1300),
Array(1012501, 1300),
Array(1012510, 1300),
Array(1012511, 1300),
Array(1003937, 3300),
Array(1702431, 4300),
Array(1702328, 4300),
Array(1004285, 1300),
Array(1004284, 1300),
Array(1004283, 1300),
Array(1004181, 1300),
Array(1004197, 2300),
Array(1004136, 2300),
Array(1102682, 4300),
Array(1072924, 4300),
Array(1052749, 4300),
Array(1002956, 1300),
Array(1004038, 3300),
Array(1000077, 3300),
Array(1000076, 3300),
Array(1004055, 3300),
Array(1004212, 3300),
Array(1004198, 3300),
Array(1004239, 3300),
Array(1004254, 3300),
Array(1004250, 3300),
Array(1004268, 3300),
Array(1004327, 3300),
Array(1004329, 3300),
Array(1004329, 3300),
Array(1004328, 3300),
Array(1004182, 2300),
Array(1004072, 2300),
Array(1004465, 2300),
Array(1004478, 2300),
Array(1004473, 2300),
Array(1004480, 3300),
Array(1102373, 1300),
Array(1003459, 1300),
Array(1052586, 2300),
Array(1050248, 4300),
Array(1051285, 3300),
Array(1051294, 3300),
Array(1051297, 3300),
Array(1051302, 3300),
Array(1051345, 3300),
Array(1051349, 2300),
Array(1051350, 3300),
Array(1050284, 4300),
Array(1050300, 3300),
Array(1051367, 3300),
Array(1052687, 2300),
Array(1052750, 4300),
Array(1051409, 4300),
Array(1051410, 6300),
Array(1052844, 3300),
Array(1052872, 4300),
Array(1052900, 4300),
Array(1082574, 3300),
Array(1082620, 3300),
Array(1082503, 2300),
Array(1112291, 4300),
Array(1004044, 2300),
Array(1102655, 2300),
Array(1004050, 1300),
Array(1702456, 6300),
Array(1052849, 2300),
Array(1102491, 1300),
Array(1052853, 3300),
Array(1004337, 2300),
Array(1004108, 3000),
Array(1052725, 2000),
Array(1072921, 1300),
Array(1702463, 5000),
Array(1052850, 1000),
Array(1001099, 1000),
Array(1051411, 5000)
);
var selectedItem = -1;
var selectedCost = -1;

function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status >= 0) {
            cm.dispose();
            return;
        }
        status--;
    }
    if (status == 0) {
        var selStr = "#fUI/UIWindow2.img/Quest/quest_info/summary_icon/summary#\r\n#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#亲爱的#r#h ##k您好，请选择您希望购买的道具：";
        for (var i = 0; i < itemList.length; i++) {
            selStr += "\r\n#L" + i + "##i" + itemList[i][0] + ":# #b#t" + itemList[i][0] + "##k   #r" + itemList[i][1]  + "#k点卷#l";
        }
        cm.sendSimple(selStr);
    } else if (status == 1) {
        var item = itemList[selection];
        if (item != null) {
            selectedItem = item[0];
            selectedCost = item[1];
            cm.sendYesNo("您是否购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + "#k 点卷？");
        } else {
            cm.sendOk("出现错误...");
            cm.dispose();
        }
    } else if (status == 2) {
        if (selectedCost <= 0 || selectedItem <= 0) {
            cm.sendOk("购买道具出现错误...");
            cm.dispose();
            return;
        }
        if (cm.getPlayer().getCSPoints(1) >= selectedCost) {
            var gachaponItem = cm.gainGachaponItem(selectedItem, 1, "点卷商店", 3, true);
            if (gachaponItem != -1) {
                cm.gainNX( - selectedCost );
                cm.sendOk("恭喜您成功购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k。");
            } else {
                cm.sendOk("购买失败，请您确认在背包所有栏目窗口中是否有一格以上的空间。");
            }
        } else {
            cm.sendOk("您没有那么多点卷。\r\n\r\n购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + "#k 点卷。");
        }
        cm.dispose();
    }
}